-
Notifications
You must be signed in to change notification settings - Fork 82
feat: include user agent sniffing #6783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| installCommand: 'pnpm install', | ||
| runCommand: 'pnpm run', | ||
| localPackageCommand: 'pnpm', | ||
| remotePackageCommand: ['pnpm', 'dlx'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about pnpx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpx was deprecated in pnpm v6, I believe, although it still seems to work as an alias
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it was un-deprecated. It's no longer documented as such. I guess it's safer to keep as this.
packages/build-info/src/package-managers/detect-package-manager.ts
Outdated
Show resolved
Hide resolved
…r.ts Co-authored-by: Matt Kane <[email protected]>
1b495d9 to
a0dd37d
Compare
packages/build-info/src/package-managers/detect-package-manager.ts
Outdated
Show resolved
Hide resolved
… options expansion without need for breaking changes, long argument list or having to handle multiple syntaxes in the future
| ({ pm }) => { | ||
| test(`fallback ${pm}`, async ({ fs }) => { | ||
| const cwd = mockFileSystem({}) | ||
| const project = new Project(fs, cwd).setEnvironment({ npm_config_user_agent: pm }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In actual usage .setEnvironment might look like this:
const project = new Project(...args).setEnvironment(process.env)
Summary
This adds npm user agent sniffing to the package manager detection logic. Previously, package manager detection logic relied on lockfiles, which requires the project to already have been created. Another use case for package manager detection logic is figuring out which package manager ran a creation flow. In that case (e.g.
npm create cloudflarevspnpm create cloudflare) there's no lockfile to go off, and so we need to rely on the user agent.This copies over logic from Wrangler with the intention of removing it in Wrangler entirely and relying on
@netlify/build-info.For us to review and ship your PR efficiently, please perform the following steps:
we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
something that`s on fire 🔥 (e.g. incident related), you can skip this step.
your code follows our style guide and passes our tests.
A picture of a cute animal (not mandatory, but encouraged)